package com.clstu.enum_.homework;

import java.util.Scanner;

public class HomeWork03 {
    public static void main(String[] args) {


       PCUsb p= new PCUsb(){//匿名内部类，就像直接new了一个接口类，却没有实际的类，
            @Override
            public int work(int a,int b) {
                System.out.println("这是在计算。。。");
                return a+b;
            }
        };
         new Phone().testWork(p);
    }
}
interface PCUsb{
    int work(int a,int b);
}

class Phone{
    Scanner sc=new Scanner(System.in);
    public void testWork(PCUsb p){
        int a;
        int b;
        System.out.println("请输入a,b计算");
        System.out.println("a:");
        a=sc.nextInt();
        System.out.println("b:");
        b=sc.nextInt();
        System.out.println(p.work(a,b));
    }
}